//
//  JXHVisitorView.swift
//  JXHSinaWeiBo
//
//  Created by juxiaohui on 16/10/14.
//  Copyright © 2016年 juxiaohui. All rights reserved.
//

import UIKit

class JXHVisitorView: UIView {
    
    // MARK: - 子控件
    @IBOutlet weak var roationImageView: UIImageView!
    
    @IBOutlet weak var iconIamgeView: UIImageView!

    @IBOutlet weak var tipLabel: UILabel!
    
    @IBOutlet weak var registBtn: UIButton!
    
    @IBOutlet weak var loginBtn: UIButton!
    // MARK: - 提供快速从XIB创建实例的方法
    
   class func visitorView() -> JXHVisitorView {
        
        return Bundle.main.loadNibNamed("JXHVisitorView", owner: nil, options: nil)!.first as! JXHVisitorView
    }
    // MARK: - 	自定义函数
    func setupVisitorViewInfo(iconName : String, title : String) {
        
        iconIamgeView.image = UIImage.init(named: iconName)
        tipLabel.text = title;
        roationImageView.isHidden = true
    }
    
    
    // MARK: - 添加转盘动画
    func addRoationAnimation() {
        //1.创建动画
        //CAKeyframeAnimation核心动画
        //CABasicAnimation//基础动画
        let basicAnimation = CABasicAnimation.init(keyPath: "transform.rotation.z")
        basicAnimation.fromValue =  0
        basicAnimation.toValue =   M_PI * 2
        basicAnimation.repeatCount = MAXFLOAT
        basicAnimation.duration = 3.0
        basicAnimation.isRemovedOnCompletion = false
        //将动画添加到图层
        roationImageView.layer.add(basicAnimation, forKey: nil)
    }
}
